<?php
class Order extends AppModel {
	var $name = 'Order';
    var $belongsTo = array(
        'Member' => array(
            'className'    => 'Member',
            'foreignKey'   => 'member_id',
            'fields'       => array('id', 'username'),
            'counterCache' => false
        )
    );
	var $hasMany = array(
        'OrderProduct' => array(
            'className'  => 'OrderProduct',
            'foreignKey' => 'order_id',
            'fields'     => array('name', 'price', 'quantity'),
            'order'      => 'OrderProduct.id ASC',
            'dependent'  => true
        ),
        'OrderHistory' => array(
            'className'  => 'OrderHistory',
            'foreignKey' => 'order_id',
            'fields'     => array('status', 'comment', 'created'),
            'order'      => 'OrderHistory.id ASC',
            'dependent'  => true
        )
    );
} // Order
?>